package com.yufeng.collaboration.service.impl;

import com.yufeng.collaboration.entity.GroupMember;
import com.yufeng.collaboration.mapper.GroupMemberMapper;
import com.yufeng.collaboration.service.GroupMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GroupMemberServiceImpl implements GroupMemberService {
    @Autowired
    private GroupMemberMapper groupMemberMapper;

    @Override
    public List<GroupMember> getGroupMembersByGroupId(Integer groupId) {
        return groupMemberMapper.selectList(new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<GroupMember>().eq("group_id", groupId));
    }

    @Override
    public void addGroupMember(GroupMember groupMember) {
        groupMemberMapper.insert(groupMember);
    }

    @Override
    public void deleteGroupMember(Integer id) {
        groupMemberMapper.deleteById(id);
    }
}
